<script setup>
import {ref,onMounted} from 'vue';
import http from '@/untils/http.js'

const params = {
    key:"fc6198937e6765be017301fa9eea9514",
    city:"金华",
};

const weatherData=ref(null)
const getWeather=async()=>{
    const response = await http.get("/simpleWeather/query",{params})
    weatherData.value=response.result;
};

onMounted(()=>{
    getWeather()
})


</script>


<template>
    <div>
        <h1>天气预报（金华）</h1>
        <div>
            <p>温度：{{ weatherData?.temperature }}</p>
            <p>湿度：{{ weatherData?.humidity }}</p>
            <p>空气质量指数：{{ weatherData?.aqi }}</p>
        </div>
    </div>
</template>